package org.hit.burkun.obo.model;

public class Dbxref {
	private boolean isFromDefinition = false;

	// private boolean isFromSynonym = false;

	public class IdRef {
		public String key;
		public String value;
	}

	private IdRef idref;
	private String xrefDesc;

	// public boolean isFromSynonym() {
	// return isFromSynonym;
	// }
	// public void setFromSynonym(boolean isFromSynonym) {
	// this.isFromSynonym = isFromSynonym;
	// }

	public boolean isFromDefinition() {
		return isFromDefinition;
	}

	public void setFromDefinition(boolean isFromDefinition) {
		this.isFromDefinition = isFromDefinition;
	}

	public String getXrefDesc() {
		return xrefDesc;
	}

	public void setXrefDesc(String xrefDesc) {
		this.xrefDesc = xrefDesc;
	}

	public IdRef getIdref() {
		return idref;
	}

	public void setIdref(String idref) {
		int idx = idref.indexOf(":");
		if (idx != 0) {
			this.idref = new IdRef();
			this.idref.key = idref.substring(0, idx).trim();
			this.idref.value = idref.substring(idx + 1).trim();
		} else {
			this.idref = new IdRef();
			this.idref.value = idref.trim();
		}

	}

	@Override
	public String toString() {
		String res = "";
		res += "idref:" + idref + " xrefDesc:" + xrefDesc;
		if (isFromDefinition) {
			res += " formDefin";
		}
		// if(isFromSynonym){
		// res += " formSyno";
		// }
		return res;
	}
}
